home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 859 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.unix.questions,comp.lang.c,comp.unix.programming
  4. Subject: Re: SIGBUS - What are the possible causes?
  5. Date: Tue, 09 Jan 96 18:58:17 GMT
  6. Organization: none
  7. Message-ID: <821213897snz@genesis.demon.co.uk>
  8. References: <4ct4es$3k7@news1.wolfe.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4ct4es$3k7@news1.wolfe.net> mcguire@wolfe.net "McGuire" writes:
  15.  
  16. >Hello all,
  17. >
  18. >I am trying to compile a program under gcc 2.7.0 that works under the
  19. >native HP-UX 9.05 cc.  In one routine I get a SIGBUS error.  When I
  20. >ignore the SIGBUS error, I get a segmentation violation.  When I add
  21. >some code to test what might be happening, the location at which the
  22. >error occurs appears to change (I am using gdb under xemacs).  Does
  23. >anyone have any ideas as to what the possible causes of such an error
  24. >might be.
  25.  
  26. 99% of the time you're doing something screwy with pointers. e.g.
  27.  
  28. 1. Using pointer arithmetic to generate pointers outside the bounds of
  29.    objects
  30.  
  31. 2. Dereferencing an illegal pointer e.g. NULL, uninitialised, 1 past the
  32.    end of an array, pointer to an object that has been freed, or one
  33.    created by an illegal cast from an integer or another pointer type.
  34.  
  35. 3. Passing an illegal pointer to free i.e. one not generated by
  36.    malloc/calloc/realloc or which has already been freed.
  37.  
  38. -- 
  39. -----------------------------------------
  40. Lawrence Kirby | fred@genesis.demon.co.uk
  41. Wilts, England | 70734.126@compuserve.com
  42. -----------------------------------------
  43.